package com.ss.android.article.base.feature.detail2.video.a;

import android.view.View;
import com.ss.android.article.base.feature.detail.model.ArticleInfo;
import com.ss.android.article.base.feature.detail.presenter.t;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.VideoAlbumInfo;
import com.ss.android.common.lib.MobClickCombiner;

final class m implements View.OnClickListener {
    private final l b;
    private final ArticleInfo a;

    m(l arg1, ArticleInfo arg2) {
        this.b = arg1;
        this.a = arg2;

    }

    public final void onClick(View arg12) {
        long v2;
        View v0;
        View v10;
        if(this.a != null && this.b.q != null) {
            int v9;
            for(v9 = this.a.relatedVideoSection; v9 < this.a.relatedVideoToutiaoList.size(); ++v9) {
                if(this.a.relatedVideoToutiaoList.get(v9).a == 0) {
                    v10 = this.b.i.inflate(com.ss.android.article.browser.R.layout.gh, this.b.q, false);
                    v0 = v10.findViewById(com.ss.android.article.browser.R.id.divider);
                    if(v9 == 0) {
                        v0.setVisibility(View.GONE);
                    }

                    this.b.q.addView(v10, -1, -2);
                    e v0_1 = new e(this.b.g, this.b.h, this.b.f, this.b.e, this.b.c, this.b.d, this.b.b, this.b.a);
                    v0_1.a(v10);
                    v10.setTag(v0_1);
                    v0_1.j = this.a.relatedVideoToutiaoList.get(v9).showTag;
                    Article v1 = this.a.relatedVideoToutiaoList.get(v9).article;
                    v2 = this.b.I != null ? this.b.I.groupId : 0;
                    v0_1.a(v1, v2, e.a);
                }
                else {
                    if(this.a.relatedVideoToutiaoList.get(v9).a == 3) {
                        v10 = this.b.i.inflate(com.ss.android.article.browser.R.layout.gh, this.b.q, false);
                        v0 = v10.findViewById(com.ss.android.article.browser.R.id.divider);
                        if(v9 == 0) {
                            v0.setVisibility(View.GONE);
                        }

                        this.b.q.addView(v10, -1, -2);
                        d v0_2 = new d(this.b.g, this.b.h, this.b.f, this.b.e, this.b.c, this.b.d, this.b.b, this.b.a);
                        v0_2.a(v10);
                        arg12.setTag(v0_2);
                        ((e)v0_2).j = this.a.relatedVideoToutiaoList.get(v9).showTag;
                        ((e)v0_2).k = this.a.relatedVideoToutiaoList.get(v9).logExtra;
                        v0_2.a(this.a.relatedVideoToutiaoList.get(v9));
                       continue;
                    }

                    v10 = this.b.i.inflate(com.ss.android.article.browser.R.layout.hs, this.b.q, false);
                    v0 = v10.findViewById(com.ss.android.article.browser.R.id.divider);
                    if(v9 == 0) {
                        v0.setVisibility(View.GONE);
                    }

                    this.b.q.addView(v10, -1, -2);
                    t v0_3 = new t(this.b.g, this.b.h, this.b.f, this.b.e, this.b.c, this.b.d, this.b.b, this.b.a);
                    v0_3.a(v10);
                    arg12.setTag(v0_3);
                    VideoAlbumInfo v1_1 = this.a.relatedVideoToutiaoList.get(v9).videoAlbumInfo;
                    v2 = this.b.I != null ? this.b.I.groupId : 0;
                    v0_3.a(v1_1, v2);
                }
            }

            this.b.r.setVisibility(View.GONE);
            MobClickCombiner.onEvent(this.b.g, "video", "detail_loadmore_relatedVideo");
        }
    }
}

